﻿@model BbsArticleListModel
@{
    CssLink.Add("~/Content/css/bbsArticleList.css");
}

<h1>@Model.게시판.제목</h1>
<hr />

<script type="text/javascript">
    function on게시판목록_카테고리변경(categoryId) {
        var url = "@Html.Raw(Url.BbsArticleList(Model.게시판.ID, 1, 0, 9999))";
        location.href = url.replace("9999", categoryId);
    }
    function 게시판검색() {
        var url = '@Html.Raw(Url.BbsArticleList(Model.게시판.ID, 1, 0, 0, 9991, "9992"))';
        var stype = $('select[name=stype]').val();
        var stext = encodeURIComponent($('input[name=stext]').val().trim());
        location.href = url.replace("9991", stype).replace("9992", stext);
    }
</script>

<div class="controls pull-right">
    @if (현재사용자.사용자.관리자) {
        <a href="@Url.BbsEdit(Model.게시판.ID)" class="btn btn-small">관리</a>
    }
    <a href="@Url.BbsArticleNew(Model.게시판.ID)" class="btn btn-small btn-primary">글쓰기</a>
</div>
<div class="form-inline">
    <span>분류:</span>
    @Html.DropDownList("categ", new SelectList(Model.게시글분류목록, "ID", "제목", Model.게시글분류), new { onchange = "on게시판목록_카테고리변경(this.value)" })

    @Html.DropDownList("stype", new SelectList(Model.게시글검색유형목록, "ID", "제목", Model.검색유형) )
    @Html.TextBox("stext", Model.검색어)
    <a onclick="게시판검색()" class="btn btn-small">검색</a>    
</div>

<table class="table table-condensed table-bordered">
    <thead>
        <tr>
            <th>번호</th>
            <th>제목</th>
            <th>작성자</th>
            <th>작성일</th>
        </tr>
    </thead>
    <tbody>
        @foreach(var 글 in Model.게시글목록) {            
            <tr onclick="document.location='@Url.BbsArticleDetail(글.ID)';">
                <td>@글.번호</td>
                <td><span>[@글.분류]</span> @글.제목</td>
                <td>@글.작성자</td>
                <td>@글.수정일.ToYMD()</td>
            </tr>
        }
    </tbody>
</table>

@Html.Partial("_Pagination", Model.페이지정보)
